/**
 * Copyright (c) 2017-2020 四川智慧云天 All rights reserved.
 *
 * https://www.sczhyt.cn
 *
 * 版权所有，侵权必究！
 */

package cn.sczhyt.modules.sys.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.sczhyt.modules.sys.entity.SysUserRoleEntity;
import cn.sczhyt.modules.sys.entity.vo.RoleSearchEntity;
import cn.sczhyt.modules.sys.entity.vo.UserInfoVoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 用户与角色对应关系
 *
 * @author Mark sunlightcs@gmail.com
 */
@Mapper
public interface SysUserRoleDao extends BaseMapper<SysUserRoleEntity> {
	
	/**
	 * 根据用户ID，获取角色ID列表
	 */
	List<String> queryRoleIdList(String userId);


	/**
	 * 根据角色ID数组，批量删除
	 */
	int deleteBatch(String[] roleIds);

	SysUserRoleEntity selectByUserId(String userId);

	List<String> selectByRoleIds(String[] roleIds);

    List<String> selectByRoleId(String roleId);

	IPage<UserInfoVoEntity> listUserIdsByRoleId(Page<UserInfoVoEntity> pages,
												@Param("search") RoleSearchEntity search);

	IPage<UserInfoVoEntity> listOrgByRoleId(Page<UserInfoVoEntity> pages,
											@Param("search") RoleSearchEntity search);
}
